﻿using AuSys.Models.App;
using AuSys.Models.Files;
using AuSys.Models.Identities;
using Microsoft.EntityFrameworkCore;

namespace AuSys.Database.Context
{
    public abstract class DataContext: DbContext
    {
        protected readonly DataContextOptions _options;
        public abstract string AcceptDbType { get; }
        protected DataContext(DataContextOptions options)
        {
            if (options.Type?.ToLower() != AcceptDbType)
                throw new InvalidOperationException(
                    $"数据库类型配置异常，应为:{AcceptDbType}");
            _options = options;
        }

        public DbSet<User> Users { get; set; }
        public DbSet<FileItem> FileItems { get; set; }
        public DbSet<LastUpdateRecord> LastUpdateRecords { get; set; }
    }
}
